<?php
    session_start();
    if(isset($_POST["email"])){
//        header('Location: ' . $_SERVER['PHP_SELF']);
        header('Location: /');
    }
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?php
	if(stristr($_SERVER['HTTP_USER_AGENT'], '(iPad;') || stristr($_SERVER['HTTP_USER_AGENT'], 'iPhone OS')) {
		echo '<meta name="apple-mobile-web-app-capable" content="yes" />';
	}

    require_once 'include/Mobile_Detect.php';
    $detect = new Mobile_Detect;
    //$deviceType = ($detect->isMobile() ? ($detect->isTablet() ? 'tablet' : 'phone') : 'computer');
    $deviceType = ($detect->isMobile() ? 'mobile' : 'computer');
?>
        <title>Biblia</title>
        <meta name="author" content="Matei Nicolae" />
        <meta name="description" content="Aplicaţie pentru studiul Bibliei traducerea Dumitru Cornilescu cu trimiteri (excelenta pentru studiul inductiv. Autor Matei Nicolae)" />
        <meta name="keywords" content="Biblia, Studiu, Dumitru Cornilescu, Biblia cu trimiteri" />
        <link type="image/ico" href="favicon.ico" rel="shortcut icon"/>

        <link rel="stylesheet" type="text/css" href="http://cdn.sencha.com/ext/gpl/3.4.1.1/resources/css/ext-all.css" />
        <link rel="stylesheet" type="text/css" href="js/ext-3.4.1/examples/ux/css/ux-all-bible.css" />

        <link rel="stylesheet" type="text/css" href="css/bible.css" />
        
        <!-- ext javascript includes -->
        <script type="text/javascript" src="http://cdn.sencha.com/ext/gpl/3.4.1.1/adapter/ext/ext-base.js"></script>
        <script type="text/javascript" src="http://cdn.sencha.com/ext/gpl/3.4.1.1/ext-all.js"></script>

        <script type="text/javascript" src="js/ext-3.4.1/examples/ux/ux-all-bible.js"></script>

        <script type="text/javascript" src="http://cdn.sencha.com/ext/gpl/3.4.1.1/src/locale/ext-lang-ro.js"></script>

        <script type="text/javascript">
            var deviceType = '<?php echo $deviceType; ?>';

            <?php if(isset($_SESSION['user_id'])) {
                require_once ("include/function.php");
            ?>
            var BibleLoggedUser = {
                    id: <?php echo $_SESSION['user_id']; ?>,
                    email: '<?php echo $_SESSION['user_email']; ?>'
                },
                BibleRecordsKeywords = <?php echo getKeywords(); ?>;
        <?php } else { ?>
            var BibleLoggedUser = false,
                BibleRecordsKeywords = [];
        <?php } ?>
        </script>

        <script type="text/javascript" src="js/bible-1.6/bible-all.js"></script>
    </head>
<body class="<?php echo $deviceType; ?>-device">

<div class="x-hide-display">
    <form method="POST" action="" name="login_form">
        <input autocomplete="on" id="input_username" name="email" type="text" />
        <input autocomplete="on" id="input_password" name="password" type="password" />
    </form>
</div>

</body>
</html>